package game.hero;

import game.exception.NoEnoughMpException;
import game.monster.Monster;

public class Doctor extends Hero implements IRecover {
//体力值上线
	private static final int MAXHP=100;
	//魔法上线
	private static final int MAXMP=100;

	public Doctor(String name,int power) {
		super(name,MAXHP, MAXMP,power);
	}

	@Override
	public int attack() {
		int power=getPower()+getWeapon().getAttack();
		System.out.println(getName()+"使用"+getWeapon().getName()+"默念咒语进行魔法攻击....");
		return power;
	}
	
	public int dizziness(Monster monster)throws NoEnoughMpException{
		if (getMp()<30) {
			throw new NoEnoughMpException("MP不足");
		}
		System.out.println(getName()+"使用眩晕技能降低怪物攻击");
		int n=monster.getPower()/2;
		monster.setPower(n);
		setMp(getMp()-30);
		return n;
	}
	public int recover() throws NoEnoughMpException {
		if (getMp()<10) {
			throw new NoEnoughMpException("MP不足");
		}
		int random=(int)(Math.random()*100);
		setHp(random+getHp());
		if (getHp()>MAXHP) {
			setHp(MAXHP);
		}		
		System.out.println(getName()+"对自己释放魔法进行治疗恢复体力");
		setMp(getMp()-10);//扣除mp
		return random;
	}


}
